const proxy = require('http-proxy-middleware');

module.exports = function(app) {
  app.use(
    // 本地服务地址转发
    proxy.createProxyMiddleware('/dev-api', {
      target: 'http://localhost:3000/',
      changeOrigin: true,
      pathRewrite: {
        '/dev-api': ''
      }
    }),
    // 服务器地址转发
    proxy.createProxyMiddleware('/prod-api', {
      target: 'http://8.134.213.180:3000/',
      changeOrigin: true,
      pathRewrite: {
        '/prod-api': ''
      }
    }),
  )
}
